package com.lanchewuyou.user.driver.lipeiui;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;

import com.afollestad.materialdialogs.MaterialDialog;
import com.lanchewuyou.user.driver.R;

/**
 * 还车结束页面
 */
public class RerurnCarOverActivity extends AppCompatActivity {
    private Toolbar mToolbar;
    private Button returnCarOverBtn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_rerurn_car_over);
        initViews();
    }
    private void initViews() {
        mToolbar = (Toolbar) findViewById(R.id.return_car_over_toolbar);
        mToolbar.setTitle("还车成功");
        setSupportActionBar(mToolbar);
        getSupportActionBar().setHomeButtonEnabled(true);
        returnCarOverBtn=(Button)findViewById(R.id.return_car_over_next_btn);
        returnCarOverBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
    @Override
    public void onBackPressed() {
            showBackDialog();
    }

    private void showBackDialog(){
        new MaterialDialog.Builder(this)
                .title("退出任务")
                .content("点击确定将回到主界面")
                .positiveText("确定")
                .negativeText("取消")
                .callback(new MaterialDialog.ButtonCallback() {
                    @Override
                    public void onPositive(MaterialDialog dialog) {
                        finish();
                    }
                    @Override
                    public void onNegative(MaterialDialog dialog) {
                        super.onNegative(dialog);
                    }
                })
                .show();
    }
}
